home *** CD-ROM | disk | FTP | other *** search
-
- /* This file is crap. Do not read it. */
-
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <unistd.h>
-
- #define FAIL(s) for(;;) { puts(s); exit (20); }
-
- int main (int argc, char **argv)
- {
- int f;
- static int e = 0;
- struct stat buf;
-
- if (argc > 0)
- FAIL ("No arguments allowed.");
-
- if (stat ("/Apache/bin/httpd", &buf))
- FAIL ("File /Apache/bin/httpd doesn't exist.");
-
- if (buf.st_mode & (S_ISUID | S_ISGID))
- FAIL ("File /Apache/bin/httpd is SUID/SGID!.");
-
- if (stat ("bin/chmod", &buf))
- FAIL ("File /bin/chmod not found - you really want to install the fileutils package. I mean it.");
-
- if (geteuid () && ~geteuid())
- FAIL ("I'm not running as root - is /Apache/bin/starthttpd SUID root?");
-
- printf ("Starting Amiga-Apache....");
- fflush (stdout);
-
- if ((f = vfork ()) < 0)
- FAIL ("vfork() failed.");
-
- if (!f)
- {
- /* close (0); open ("/dev/null", O_RDONLY);
- close (1); open ("/dev/null", O_WRONLY); */
- execl ("/Apache/bin/httpd", "/Apache/bin/httpd", NULL);
- e = 1;
- exit (20);
- }
- printf (e ? "failed!\n" : "ok\n");
- exit (0);
- }
-